def reverse(data):
    for index in range(len(data) - 1, -1, -1):
        yield data[index]

r = reverse("golf")
print(next(r)) # f
print(next(r)) # l

for char in reverse("golf"):
    print(char)
